home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / program / palis.lha / Palis / src / vpl / plView.c < prev    next >
C/C++ Source or Header  |  1992-09-02  |  2KB  |  117 lines

  1. /*
  2.     ·C·O·D·E·X· ·D·E·S·I·G·N· ·S·O·F·T·W·A·R·E·
  3.     presents
  4.  
  5.     ViewPALIS
  6.  
  7.     this is a little example how to inform the user which patches
  8.     are currently managed by PALIS
  9.  
  10.     FILE:    plView.c
  11.     TASK:    upraisin'
  12.  
  13.     (c)1995 by Hans Bühler, h0348kil@rz.hu-berlin.de
  14. */
  15.  
  16. #include    "plView.h"
  17.  
  18. // ---------------------------
  19. // defines
  20. // ---------------------------
  21.  
  22. // ---------------------------
  23. // datatypes
  24. // ---------------------------
  25.  
  26. // ---------------------------
  27. // proto
  28. // ---------------------------
  29.  
  30. // ---------------------------
  31. // vars
  32. // ---------------------------
  33.  
  34. struct Library        *GadToolsBase    =    0,
  35.                         *CxBase            =    0,
  36.                         *DiskfontBase    =    0,
  37.                         *IconBase        =    0;
  38. struct MsgPort        *CxPort            =    0,
  39.                         *MsgPort            =    0;
  40.  
  41. // ---------------------------
  42.  
  43. extern char            *__version        =    PROGNAME_VER;
  44.  
  45. // ---------------------------
  46. // funx: system
  47. // ---------------------------
  48.  
  49. static BOOL InitSys(void)
  50. {
  51.     if(!( GadToolsBase = OpenLibrary("gadtools.library",37) ) ||
  52.         !( CxBase         = OpenLibrary("commodities.library",37) ) ||
  53.         !( IconBase         = OpenLibrary("icon.library",37) ) ||
  54.         !( DiskfontBase = OpenLibrary("diskfont.library",37) ))
  55.     {
  56.         return ErrorReq(    PROGNAME ": Cannot open\n"
  57.                                 "gadtools.library    V37+ or\n"
  58.                                 "icon.library        V37+ or\n"
  59.                                 "commodities.library V37+ or\n"
  60.                                  "diskfont.library    V37+ !",0,0,0,0);
  61.     }
  62.  
  63.     if(!( MsgPort = CreateMsgPort() ) ||
  64.         !( CxPort = CreateMsgPort() ))
  65.     {
  66.         return ErrorReq(PROGNAME ": No msg ports !",0,0,0,0);
  67.     }
  68.  
  69.     return TRUE;
  70. }
  71.  
  72. static void RemSys(void)
  73. {
  74.     struct Message    *msg;
  75.  
  76.     if(MsgPort)
  77.         DeleteMsgPort(MsgPort);        // all msgs my own !
  78.  
  79.     if(CxPort)
  80.     {
  81.         while(msg = GetMsg(CxPort))
  82.             ReplyMsg(msg);
  83.  
  84.         DeleteMsgPort(CxPort);
  85.     }
  86.  
  87.     if(IconBase)
  88.         CloseLibrary(IconBase);
  89.     if(CxBase)
  90.         CloseLibrary(CxBase);
  91.     if(DiskfontBase)
  92.         CloseLibrary(DiskfontBase);
  93.     if(IconBase)
  94.         CloseLibrary(IconBase);
  95. }
  96.  
  97. // ---------------------------
  98. // funx: main
  99. // ---------------------------
  100.  
  101. void main(int argc, char *argv[])
  102. {
  103.     if(InitSys())
  104.     {
  105.         if(InitPrefs(argc,argv))
  106.         {
  107.             if(InitCom())
  108.             {
  109.                 MainLoop();
  110.             }
  111.             RemCom();
  112.         }
  113.         RemPrefs();
  114.     }
  115.     RemSys();
  116. }
  117.